<template>
  <div class="nav">
    <ul>
      <li @click="change" :class="{active:selectIndex==index}">{{item.name}}</li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
    },
    selectIndex: {
      type: Number,
    },
    index: {
      type: Number,
    },
  },
  methods: {
    change() {
      this.$emit("change", this.index);
    },
  },
};
</script>

<style scoped>
ol,
ul {
  list-style: none;
  width: 100%;
}
ul li {
  width: 100%;
  height: 40px;
  line-height: 60px;
  text-indent: 10px;
  font-size: 16px;
  box-sizing: border-box;
}
ul li.active {
  border-left: 3px solid red;
}
</style>